﻿<cfsilent>
	<cfscript>
	
		jsonAdvice = getProperty("serviceFactory").getBean("jsonAdvice");
		datetimeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");
		
		termId = event.getArg("TID");
		courseId = event.getArg("CID");
		taskType = event.getArg("TT");
		taskId = event.getArg("TSK");
		chooserId = event.getArg("SCC");
		
		chooseProp = getProperty("serviceFactory").getBean("choosePropertyAdvice");
		
		/* 学籍相关信息 */
		studentId = event.getArg("STU");
		
		/* 回执信息 */
		response = structNew();
		structInsert(response, "success", false, true);
		
		transaction {
			
			sql = "	SELECT
						sc.choose_prop
					FROM
						t_student_course sc
					WHERE
						sc.scc_id = :chooserId ";
						
			queryObj = new Query(datasource = application.dnsMaster, maxRows = 1);
			queryObj.addParam(name = "chooserId", value = chooserId, cfsqltype = "cf_sql_char");
			rs_studentCourseEntity = queryObj.execute(sql = sql).getResult();
			
			chooseProp.parseProperty( rs_studentCourseEntity.choose_prop );
			
			chooseProp.setPaid(true);
			chooseProp.setCharged(true);
			
			/* 标注缴费时间 */
			sql = "	UPDATE
						t_student_course sc
					SET
						sc.charge_time = :chargeTime ,
						sc.choose_prop = :chooseProps 
					WHERE
						sc.scc_id = :chooserId ";
			
			queryObj = new Query(datasource = application.dnsMaster);
			queryObj.addParam(name = "chooserId", value = chooserId, cfsqltype = "cf_sql_char");
			queryObj.addParam(name = "chooseProps", value = chooseProp.stringProperty(), cfsqltype = "cf_sql_varchar");
			queryObj.addParam(name = "chargeTime", value = datetimeAdvice.getCurrentDatetimeString(), cfsqltype = "cf_sql_char");
			queryObj.execute(sql = sql);
			
			structInsert(response, "success", true, true);

		}

		
	</cfscript>
</cfsilent><cfoutput>#jsonAdvice.encode(data:response, stringNumbers:true)#</cfoutput>